home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.1 / card_16715.txt < prev    next >
Text File  |  1989-02-26  |  1KB  |  52 lines

  1. -- card: 16715 from stack: in.1
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 2202
  5. -- name: VolumeName
  6. ----- HyperTalk script -----
  7. function VolumeName path
  8. put empty into vol
  9. repeat with i = 1 to the length of path
  10.   if character i of path is ":" then -- Stop at first colon
  11.     put ":" after vol
  12.     return vol
  13.   else
  14.     put character i of path after vol
  15.   end if
  16. end repeat
  17. answer "Bad path given to VolumeName" with "OK"
  18. return empty
  19. end VolumeName
  20.  
  21.  
  22.  
  23. -- part contents for background part 10
  24. ----- text -----
  25. 5
  26.  
  27. -- part contents for background part 2
  28. ----- text -----
  29. --
  30. -- VolumeName -- given a file pathname, return the name of the volume
  31. -- it resides on. Straightforward string munging.
  32. --
  33. function VolumeName path
  34.   put empty into vol
  35.   repeat with i = 1 to the length of path
  36.     if character i of path is ":" then -- Stop at first colon
  37.       put ":" after vol
  38.       return vol
  39.     else
  40.       put character i of path after vol
  41.     end if
  42.   end repeat
  43.   
  44.   -- If we reach here, there's something drastically wrong.
  45.   answer "Bad path given to VolumeName" with "OK"
  46.   return empty
  47. end VolumeName
  48.  
  49.  
  50. -- part contents for background part 3
  51. ----- text -----
  52. VolumeName